package com.ruike.alisurface.http;

import com.google.protobuf.Api;
import com.ruike.alisurface.utils.ShareKey;
import com.voodoo.lib_frame.base.BaseView;
import com.voodoo.lib_frame.httpTools.ApiTools;
import com.voodoo.lib_frame.httpTools.RequestParams;
import com.voodoo.lib_utils.ShareUtils;

import org.json.JSONException;
import org.json.JSONObject;

public class BinZhouHttp {

    // 刷卡领取
    public static final String RECEIVE_URL = "https://rk.shouhuojiyun.com/otherApi/binzhou_milk_card/start_out";
    // 订单结束
    public static final String END_ORDER_URL = "https://rk.shouhuojiyun.com/otherApi/binzhou_milk_card/EndOrder";

    /**
     * 根据卡号获取出货货道号
     *
     * @param cardId   卡号
     * @param listener 监听回调
     */
    public static void getSlotByCard(String cardId, BaseView listener) {
        RequestParams params = new RequestParams();
        params.put("card_no", cardId);
        params.put("mch_id", ShareUtils.getInstance().getString(ShareKey.MCH_ID));
        new ApiTools().getRequest(RECEIVE_URL, params, listener);
    }

    /**
     * 订单出货完成
     *
     * @param orderId   订单号
     * @param isSuccess 是否成功
     * @param remark    备注
     * @param listener  监听回调
     */
    public static void endOrder(String orderId, boolean isSuccess, String remark, BaseView listener) {
        RequestParams params = new RequestParams();
        params.put("order_id", orderId);
        params.put("IsEnd", isSuccess);
        params.put("remark", remark);
        new ApiTools().getRequest(END_ORDER_URL, params, listener);
    }


}
